<?php
/**
 * @param $links
 * @param $active
 * @param $wrapper
 */
$items = array();
$separator = @$separator ? $separator : '';

foreach ($links as $title => $url) {
  $here = array_shift($url);

  // match the prefix to see if we are on the active trail
  $re_tail = @$match_full ? '$#' : '#';
  
  $attr = preg_match('#^' . $here . $re_tail, $this->here) ? " $active" : '';
  //D var_dump(array('attr' => $attr, 'this.here' => $this->here, 'here' => $here));
  $items[] = strtr($wrapper, 
    array(
      '%link' => $html->link('<span>' . $title . '</span>', $url, array(), FALSE, FALSE),
      '%active' => $attr
    ));
}
echo join($separator, $items), "\n";
?>
